/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.gs.practice.thread.util;

import com.gs.utils.swing.window.WindowManager;
import com.gs.utils.swing.window.WindowUtil;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import javax.swing.ImageIcon;
import static javax.swing.JFrame.EXIT_ON_CLOSE;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

/**
 *
 * @author Sabuj
 */
public class ProducerConsumerFrame extends javax.swing.JFrame {
    private static final WindowManager WINDOW_MANAGER = WindowManager.getManager();
    
    private final CircularArrayQueue<Integer> bufferQueue = new CircularArrayQueue<Integer>(20);
    /**
     * Creates new form ProducerConsumerFrame
     */
    public ProducerConsumerFrame() {
        setTitle("Producer - Consumer : Circular Queue using Array");
        setSize(800, 640);
        setMinimumSize(getSize());
        setIconImage((new ImageIcon(getClass()
                .getResource("/images/send-receive-24x24.png"))).getImage());
        WindowUtil.bringToCenter(this);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        initComponents();
        WINDOW_MANAGER.baseDesktopPane = this.baseDesktopPane;
        WINDOW_MANAGER.windowManagerLabel = this.windowManagerLabel;
        WINDOW_MANAGER.windowManagerPopupMenu = this.windowManagerPopupMenu;
        
        initBufferStatusPanel();
    }

    
    
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        baseDesktopPopupMenu = new javax.swing.JPopupMenu();
        minimizeAllMenuItem = new javax.swing.JMenuItem();
        maximizeAllMenuItem = new javax.swing.JMenuItem();
        windowManagerPopupMenu = new javax.swing.JPopupMenu();
        showAllMenuItem = new javax.swing.JMenuItem();
        baseToolBar = new javax.swing.JToolBar();
        newProducerButton = new javax.swing.JButton();
        newConsumerButton = new javax.swing.JButton();
        basePanel = new javax.swing.JPanel();
        bufferStatusPanel = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        arrayViewerPanel = new javax.swing.JPanel();
        baseDesktopPane = new javax.swing.JDesktopPane();
        desktopImageLabel = new javax.swing.JLabel();
        baseStatusBar = new javax.swing.JToolBar();
        indowMgrImageLabel = new javax.swing.JLabel();
        windowManagerLabel = new javax.swing.JLabel();
        jSeparator5 = new javax.swing.JToolBar.Separator();
        statusPanel = new javax.swing.JPanel();
        statusLabel = new javax.swing.JLabel();
        jSeparator8 = new javax.swing.JToolBar.Separator();
        baseMenuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        newProducerMenuItem = new javax.swing.JMenuItem();
        newConsumerMenuItem = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        minimize2trayMenuItem = new javax.swing.JMenuItem();
        exitMenuItem = new javax.swing.JMenuItem();
        helpMenu = new javax.swing.JMenu();
        helpMenuItem = new javax.swing.JMenuItem();
        aboutMenuItem = new javax.swing.JMenuItem();

        FormListener formListener = new FormListener();

        minimizeAllMenuItem.setText("Minimize All");
        minimizeAllMenuItem.addActionListener(formListener);
        baseDesktopPopupMenu.add(minimizeAllMenuItem);

        maximizeAllMenuItem.setText("Maximize All");
        maximizeAllMenuItem.addActionListener(formListener);
        baseDesktopPopupMenu.add(maximizeAllMenuItem);

        showAllMenuItem.setText("Show All");
        showAllMenuItem.addActionListener(formListener);
        windowManagerPopupMenu.add(showAllMenuItem);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new java.awt.BorderLayout());

        baseToolBar.setFloatable(false);
        baseToolBar.setRollover(true);

        newProducerButton.setText("+P");
        newProducerButton.setFocusable(false);
        newProducerButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        newProducerButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        newProducerButton.addActionListener(formListener);
        baseToolBar.add(newProducerButton);

        newConsumerButton.setText("+C");
        newConsumerButton.setFocusable(false);
        newConsumerButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        newConsumerButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        newConsumerButton.addActionListener(formListener);
        baseToolBar.add(newConsumerButton);

        getContentPane().add(baseToolBar, java.awt.BorderLayout.PAGE_START);

        basePanel.setBackground(new java.awt.Color(204, 204, 255));
        basePanel.setLayout(new java.awt.GridBagLayout());

        bufferStatusPanel.setBackground(new java.awt.Color(204, 204, 255));
        bufferStatusPanel.setMaximumSize(new java.awt.Dimension(32767, 120));
        bufferStatusPanel.setMinimumSize(new java.awt.Dimension(480, 70));
        bufferStatusPanel.setPreferredSize(new java.awt.Dimension(480, 70));
        bufferStatusPanel.setLayout(new java.awt.GridBagLayout());

        jLabel1.setText("jLabel1");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        bufferStatusPanel.add(jLabel1, gridBagConstraints);

        jLabel2.setText("jLabel2");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        bufferStatusPanel.add(jLabel2, gridBagConstraints);

        arrayViewerPanel.setBackground(new java.awt.Color(255, 255, 255));
        arrayViewerPanel.setMaximumSize(new java.awt.Dimension(32767, 40));
        arrayViewerPanel.setMinimumSize(new java.awt.Dimension(100, 40));
        arrayViewerPanel.setPreferredSize(new java.awt.Dimension(100, 40));
        arrayViewerPanel.setLayout(new java.awt.BorderLayout());
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        bufferStatusPanel.add(arrayViewerPanel, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        basePanel.add(bufferStatusPanel, gridBagConstraints);

        baseDesktopPane.setDoubleBuffered(true);
        baseDesktopPane.setMinimumSize(new java.awt.Dimension(500, 300));
        baseDesktopPane.setPreferredSize(new java.awt.Dimension(640, 350));
        baseDesktopPane.addComponentListener(formListener);

        desktopImageLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        baseDesktopPane.add(desktopImageLabel);
        desktopImageLabel.setBounds(364, 114, 260, 240);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        basePanel.add(baseDesktopPane, gridBagConstraints);

        getContentPane().add(basePanel, java.awt.BorderLayout.CENTER);

        baseStatusBar.setFloatable(false);
        baseStatusBar.setRollover(true);
        baseStatusBar.setMaximumSize(new java.awt.Dimension(36, 25));
        baseStatusBar.setMinimumSize(new java.awt.Dimension(47, 23));
        baseStatusBar.setPreferredSize(new java.awt.Dimension(100, 23));

        indowMgrImageLabel.setText(" ");
        baseStatusBar.add(indowMgrImageLabel);

        windowManagerLabel.setText("Window Manager");
        windowManagerLabel.setEnabled(false);
        windowManagerLabel.addMouseListener(formListener);
        baseStatusBar.add(windowManagerLabel);
        baseStatusBar.add(jSeparator5);

        statusPanel.setLayout(new java.awt.GridBagLayout());

        statusLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        statusPanel.add(statusLabel, gridBagConstraints);

        baseStatusBar.add(statusPanel);
        baseStatusBar.add(jSeparator8);

        getContentPane().add(baseStatusBar, java.awt.BorderLayout.PAGE_END);

        fileMenu.setText("File");

        newProducerMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        newProducerMenuItem.setText("New Producer");
        newProducerMenuItem.addActionListener(formListener);
        fileMenu.add(newProducerMenuItem);

        newConsumerMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        newConsumerMenuItem.setText("New Consumer");
        newConsumerMenuItem.addActionListener(formListener);
        fileMenu.add(newConsumerMenuItem);
        fileMenu.add(jSeparator2);

        minimize2trayMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_MASK));
        minimize2trayMenuItem.setText("Minimize to Tray ");
        minimize2trayMenuItem.addActionListener(formListener);
        fileMenu.add(minimize2trayMenuItem);

        exitMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK));
        exitMenuItem.setText("Exit");
        exitMenuItem.addActionListener(formListener);
        fileMenu.add(exitMenuItem);

        baseMenuBar.add(fileMenu);

        helpMenu.setText("Help");

        helpMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        helpMenuItem.setText("Help");
        helpMenuItem.addActionListener(formListener);
        helpMenu.add(helpMenuItem);

        aboutMenuItem.setText("About");
        aboutMenuItem.addActionListener(formListener);
        helpMenu.add(aboutMenuItem);

        baseMenuBar.add(helpMenu);

        setJMenuBar(baseMenuBar);

        pack();
    }

    // Code for dispatching events from components to event handlers.

    private class FormListener implements java.awt.event.ActionListener, java.awt.event.ComponentListener, java.awt.event.MouseListener {
        FormListener() {}
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            if (evt.getSource() == newProducerButton) {
                ProducerConsumerFrame.this.newProducerButtonActionPerformed(evt);
            }
            else if (evt.getSource() == newConsumerButton) {
                ProducerConsumerFrame.this.newConsumerButtonActionPerformed(evt);
            }
            else if (evt.getSource() == minimizeAllMenuItem) {
                ProducerConsumerFrame.this.minimizeAllMenuItemActionPerformed(evt);
            }
            else if (evt.getSource() == maximizeAllMenuItem) {
                ProducerConsumerFrame.this.maximizeAllMenuItemActionPerformed(evt);
            }
            else if (evt.getSource() == showAllMenuItem) {
                ProducerConsumerFrame.this.showAllMenuItemActionPerformed(evt);
            }
            else if (evt.getSource() == newProducerMenuItem) {
                ProducerConsumerFrame.this.newProducerMenuItemActionPerformed(evt);
            }
            else if (evt.getSource() == newConsumerMenuItem) {
                ProducerConsumerFrame.this.newConsumerMenuItemActionPerformed(evt);
            }
            else if (evt.getSource() == minimize2trayMenuItem) {
                ProducerConsumerFrame.this.minimize2trayMenuItemActionPerformed(evt);
            }
            else if (evt.getSource() == exitMenuItem) {
                ProducerConsumerFrame.this.exitMenuItemActionPerformed(evt);
            }
            else if (evt.getSource() == helpMenuItem) {
                ProducerConsumerFrame.this.helpMenuItemActionPerformed(evt);
            }
            else if (evt.getSource() == aboutMenuItem) {
                ProducerConsumerFrame.this.aboutMenuItemActionPerformed(evt);
            }
        }

        public void componentHidden(java.awt.event.ComponentEvent evt) {
        }

        public void componentMoved(java.awt.event.ComponentEvent evt) {
        }

        public void componentResized(java.awt.event.ComponentEvent evt) {
            if (evt.getSource() == baseDesktopPane) {
                ProducerConsumerFrame.this.baseDesktopPaneComponentResized(evt);
            }
        }

        public void componentShown(java.awt.event.ComponentEvent evt) {
        }

        public void mouseClicked(java.awt.event.MouseEvent evt) {
            if (evt.getSource() == windowManagerLabel) {
                ProducerConsumerFrame.this.windowManagerLabelMouseClicked(evt);
            }
        }

        public void mouseEntered(java.awt.event.MouseEvent evt) {
            if (evt.getSource() == windowManagerLabel) {
                ProducerConsumerFrame.this.windowManagerLabelMouseEntered(evt);
            }
        }

        public void mouseExited(java.awt.event.MouseEvent evt) {
            if (evt.getSource() == windowManagerLabel) {
                ProducerConsumerFrame.this.windowManagerLabelMouseExited(evt);
            }
        }

        public void mousePressed(java.awt.event.MouseEvent evt) {
            if (evt.getSource() == windowManagerLabel) {
                ProducerConsumerFrame.this.windowManagerLabelMousePressed(evt);
            }
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            if (evt.getSource() == windowManagerLabel) {
                ProducerConsumerFrame.this.windowManagerLabelMouseReleased(evt);
            }
        }
    }// </editor-fold>//GEN-END:initComponents

    private void newProducerMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newProducerMenuItemActionPerformed
        addProducer();
    }//GEN-LAST:event_newProducerMenuItemActionPerformed

    private void addProducer(){
        String name = JOptionPane.showInputDialog(this, "Enter Producer Name: ");
        if(null == name || name.length() <= 0)
            return;
        if (WINDOW_MANAGER.containsFrame(WindowConstants.PRODUCER_WINDOW_TITLE + name)) {
            WINDOW_MANAGER.showFrame(WindowConstants.PRODUCER_WINDOW_TITLE + name);
            return;
        }
        JPanel secureSplitPanel = new ProducerPanel(bufferQueue);
        BaseInternalFrame baseInternalFrame = new BaseInternalFrame(secureSplitPanel);
        baseInternalFrame.setTitle(WindowConstants.PRODUCER_WINDOW_TITLE + name);
        baseInternalFrame.setFrameIcon(new javax.swing.ImageIcon(getClass()
                .getResource("/images/sender-24x24.png")));
        WINDOW_MANAGER.addIFrame(baseInternalFrame);
    }
    
    private void addConsumer(){
        String name = JOptionPane.showInputDialog(this, "Enter Consumer Name: ");
        if(null == name || name.length() <= 0)
            return;
        if (WINDOW_MANAGER.containsFrame(WindowConstants.CONSUMER_WINDOW_TITLE + name)) {
            WINDOW_MANAGER.showFrame(WindowConstants.CONSUMER_WINDOW_TITLE + name);
            return;
        }
        JPanel secureSplitPanel = new ProducerPanel(bufferQueue);
        BaseInternalFrame baseInternalFrame = new BaseInternalFrame(secureSplitPanel);
        baseInternalFrame.setTitle(WindowConstants.CONSUMER_WINDOW_TITLE + name);
        baseInternalFrame.setFrameIcon(new javax.swing.ImageIcon(getClass()
                .getResource("/images/recieve-22x22.png")));
        WINDOW_MANAGER.addIFrame(baseInternalFrame);
    }
    
    private void minimize2trayMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_minimize2trayMenuItemActionPerformed
        ActionListener exitListener = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.exit(0);
            }
        };
        WindowUtil.minimizeToTray(this, new javax.swing.ImageIcon(getClass()
            .getResource("/images/send-receive-24x24.png")).getImage(),
        exitListener);
    }//GEN-LAST:event_minimize2trayMenuItemActionPerformed

    private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed

        System.exit(0);
    }//GEN-LAST:event_exitMenuItemActionPerformed

    private void helpMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_helpMenuItemActionPerformed

    }//GEN-LAST:event_helpMenuItemActionPerformed

    private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutMenuItemActionPerformed

    }//GEN-LAST:event_aboutMenuItemActionPerformed

    private void windowManagerLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_windowManagerLabelMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_windowManagerLabelMouseClicked

    private void windowManagerLabelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_windowManagerLabelMouseEntered
        windowManagerLabel.setForeground(UiConstants.LINK_FG_COLOR);
        windowManagerLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    }//GEN-LAST:event_windowManagerLabelMouseEntered

    private void windowManagerLabelMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_windowManagerLabelMouseExited
        windowManagerLabel.setForeground(Color.BLACK);
        windowManagerLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }//GEN-LAST:event_windowManagerLabelMouseExited

    private void windowManagerLabelMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_windowManagerLabelMousePressed
        if (MouseEvent.BUTTON1 == evt.getButton() && windowManagerLabel.isEnabled()) {
            windowManagerPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
        }
    }//GEN-LAST:event_windowManagerLabelMousePressed

    private void windowManagerLabelMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_windowManagerLabelMouseReleased
        if (MouseEvent.BUTTON1 == evt.getButton() && windowManagerLabel.isEnabled()) {
            windowManagerPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
        }
    }//GEN-LAST:event_windowManagerLabelMouseReleased

    private void baseDesktopPaneComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_baseDesktopPaneComponentResized
        Dimension d = baseDesktopPane.getSize();
        int x = d.width - 264;
        int y = d.height - 244;
        desktopImageLabel.setBounds(x, y, 260, 240);
    }//GEN-LAST:event_baseDesktopPaneComponentResized

    private void minimizeAllMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_minimizeAllMenuItemActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_minimizeAllMenuItemActionPerformed

    private void maximizeAllMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_maximizeAllMenuItemActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_maximizeAllMenuItemActionPerformed

    private void showAllMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showAllMenuItemActionPerformed
        WINDOW_MANAGER.showAllFrames();
    }//GEN-LAST:event_showAllMenuItemActionPerformed

    private void newConsumerMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newConsumerMenuItemActionPerformed
        addConsumer();
    }//GEN-LAST:event_newConsumerMenuItemActionPerformed

    private void newProducerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newProducerButtonActionPerformed
        addProducer();
    }//GEN-LAST:event_newProducerButtonActionPerformed

    private void newConsumerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newConsumerButtonActionPerformed
        addConsumer();
    }//GEN-LAST:event_newConsumerButtonActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ProducerConsumerFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ProducerConsumerFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ProducerConsumerFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ProducerConsumerFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ProducerConsumerFrame().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem aboutMenuItem;
    private javax.swing.JPanel arrayViewerPanel;
    private javax.swing.JDesktopPane baseDesktopPane;
    private javax.swing.JPopupMenu baseDesktopPopupMenu;
    private javax.swing.JMenuBar baseMenuBar;
    private javax.swing.JPanel basePanel;
    private javax.swing.JToolBar baseStatusBar;
    private javax.swing.JToolBar baseToolBar;
    private javax.swing.JPanel bufferStatusPanel;
    private javax.swing.JLabel desktopImageLabel;
    private javax.swing.JMenuItem exitMenuItem;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JMenu helpMenu;
    private javax.swing.JMenuItem helpMenuItem;
    private javax.swing.JLabel indowMgrImageLabel;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JToolBar.Separator jSeparator5;
    private javax.swing.JToolBar.Separator jSeparator8;
    private javax.swing.JMenuItem maximizeAllMenuItem;
    private javax.swing.JMenuItem minimize2trayMenuItem;
    private javax.swing.JMenuItem minimizeAllMenuItem;
    private javax.swing.JButton newConsumerButton;
    private javax.swing.JMenuItem newConsumerMenuItem;
    private javax.swing.JButton newProducerButton;
    private javax.swing.JMenuItem newProducerMenuItem;
    private javax.swing.JMenuItem showAllMenuItem;
    private javax.swing.JLabel statusLabel;
    private javax.swing.JPanel statusPanel;
    private javax.swing.JLabel windowManagerLabel;
    private javax.swing.JPopupMenu windowManagerPopupMenu;
    // End of variables declaration//GEN-END:variables
    private JLabel bufferSizeLabel;
    private ArrayView arrayView;
    
    private void initBufferStatusPanel() {
        
        arrayView = new ArrayView(bufferQueue);
        arrayView.setMinimumSize(new Dimension(300, 32));
        arrayView.setPreferredSize(new Dimension(300, 32));
        arrayView.setMaximumSize(new Dimension(300, 32));
        
        arrayViewerPanel.add(arrayView, BorderLayout.CENTER);
    }
}
